package com.gluck.cases.common.utils.utils;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.session.Session;
import org.apache.shiro.subject.Subject;

/**
 * @ClassName ShiroUsersUtil
 * @Desc shiro 用户信息工具类
 * @Author shiyongzhe
 * @Date 2022/5/28 - 5:00 下午
 **/
public class ShiroUsersUtil {

    public static Subject getSubject(){
        Subject subject = SecurityUtils.getSubject();
        return subject;
    }

    public static Session getSession(){
        return getSubject().getSession();
    }

    /**
     * 功能描述: 获取当前用户的token
     * @Params []
     * @Return java.lang.String
     * @Author I`m Gluck
     * @Date 2022/5/28
     */
    public static String getUserToken(){
        String token = (String) getSubject().getPrincipal();
        return token;
    }
}
